package com.apes.fn.scm.settleCheck.model;

import com.alibaba.fastjson.annotation.JSONField;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.Model;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.framework.util.ApesConst;
import com.apes.framework.util.DateUtil;
import com.apes.scm.masterdata.finance.model.IncomeType;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * 功能：当期平台应收费用
 *
 * @author zhuyh
 * @time 15:02
 * @date 2020/3/6
 */
@Deprecated
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = RclPlatformReceivable.CONST_TABLE_NAME)
public class RclPlatformReceivable extends Model {



    public static final String CONST_TABLE_NAME = "fn_platformreceivable";

    @Id
    @Column(name = "id", nullable = false, length = 24)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "当期平台应收费用单号", padding = 12)
    private String id;


    @Column(name = "paymentid", length = 250)
    @Comment("费用单号")
    private String paymentid;


    @NotNull
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "expense_type_id", referencedColumnName = "id")
    @Comment("费用类型")
    private IncomeType expenseType;


    @JSONField(format = DateUtil.SHOW_DATETIME_FORMAT)
    @Temporal(TemporalType.DATE)
    @Column(name = "start_date")
    @Comment("业务期间起")
    private Date startDate; //业务期间起

    @JSONField(format = DateUtil.SHOW_DATETIME_FORMAT)
    @Temporal(TemporalType.DATE)
    @Column(name = "end_date")
    @Comment("业务期间止")
    private Date endDate; //业务期间止

    @ManyToOne(optional = false)
    @JoinColumn(name = "partnerAccountStatement_id", referencedColumnName = "id", nullable = false)
    @Comment("赋能对账单号")
    private RclPartnerAccountStatement rclPartnerAccountStatement;


    @Column(name = "money", nullable = false, columnDefinition = ApesConst.FIELD_QTY_16_4_0)
    @Comment("金额")
    private double money = 0.0;//

    @JSONField(format = DateUtil.SHOW_DATETIME_FORMAT)
    @Temporal(TemporalType.DATE)
    @Column(name = "create_date")
    @Comment("制单日期")
    private Date createDate; //制单日期

    @Column(name = "comfirm", nullable = false)
    @Comment("确认")
    private int comfirm = 0;//

    @Column(name = "marker", length = 250)
    @Comment("差异说明")
    private String marker;
}
